<div class="container-fluid">
    <div class="row-fluid">
        <div class="span3">
            <?php echo $this->partial('_menu.phtml') ?>
            <!--/.well -->
        </div>
        <!--/span-->
        <div class="span9">
            <div class="wrap">
                <?php echo $this->partial('_message.phtml') ?>
                <div id="main-content">
                <div class="top-link"><a href="<?php echo $this->baseUrl() ?>/admin/ventes/ajout">Ajouter une vente</a></div>
                    <table>
                        <thead>
                            <tr>
                                <th style="width:10%">Vente</th>
                                <th>Titre</th>
                                <th>% Com</th>
                                <th>Vente on-line ?</th>
                                <th>Articles on-line ?</th>
                                <th>Editer</th>
                                <th>Supprimer</th>
                            </tr>
                        </thead>
                        <tfoot>
                            <tr>
                                <td colspan="10">
                                    <?php if(count($this->paginator) > 1) :?>
                                        <?php echo $this->paginationControl($this->paginator, 'Sliding', '_pagination.phtml'); ?>
                                    <?php endif;?>
                                    <!-- End .pagination -->

                                    <div class="clear"></div>
                               </td>
                            </tr>
                        </tfoot>
                        <tbody>
                        <?php
                        foreach($this->paginator as $rs) :
                            $dtvente = new DateTime($rs['dtvente']);
                        ?>
                            <tr>
                                <td style="text-align:left"><?php echo $dtvente->format('d/m/Y');?></td>
                                <td style="text-align:left"><?php echo stripslashes($rs['titre']);?></td>
                                <td><?php echo $rs['com'];?></td>
                                <td><img src="<?php echo $this->baseUrl() ?>/images/<?php echo $rs['visible']?>.png"></td>
                                <td><img src="<?php echo $this->baseUrl() ?>/images/<?php echo $rs['articles_en_ligne']?>.png"></td>
                                <td><a href="<?php echo $this->baseUrl() ?>/admin/ventes/ajout/id/<?php echo $rs['p_ventes']?>"><img src="<?php echo $this->baseUrl()?>/images/pencil.png"></a></td>
                                <td><a href="javascript:void(0)" id="<?php echo $rs['p_ventes']?>" class="delete"><img src="<?php echo $this->baseUrl()?>/images/cross.png"></a></td>
                        <?php endforeach;?>
                        </tbody>
                    </table>
                </div>
            </div>
            <!--/row-->
        </div>
        <!--/span-->
    </div>
    <!--/row-->
</div>
<script type="text/javascript">
$(document).ready(function(){
	$('.delete').click(function(){
		if (confirm("Etes-vous sûr de vouloir effacer?")) {
			var baseUrl = '<?php echo $this->baseUrl()?>';
			var id = $(this).attr('id');
			var page = '<?php echo $this->page ?>';
			document.location.href = baseUrl + '/admin/ventes/delete-ventes/id/'+ id +'/page/'+ page;
		}
  	});
});
</script>